import java.io.IOException;
import java.sql.SQLException;

import javax.naming.NamingException;


/**
 * @author Yin Zhang, 5393558
 * @version 0.1, 07 May 2008, initial creation
 */
public class RunBuild001Staff
{	
	public static void main(String[] args) throws SQLException, NamingException, IOException
	{
		StaffUserStory1 sus1 = null;
		StaffUserStory2 sus2 = null;
		StaffUserStory3 sus3 = null;
		
		try
		{
			if (args.length == 1)
			{
				sus1 = new StaffUserStory1();
				sus1.printSubmission(args[0]);
			}
			else if(args.length == 2)
			{
				if(!args[1].endsWith(".zip"))
				{
					throw new IllegalArgumentException("Only zip filesaccepted");
				}
				else
				{
					sus2 = new StaffUserStory2();
					sus2.uploadAssignment(args[0], args[1]);
				}
			}
			else if(args.length == 5)
			{
				sus3 = new StaffUserStory3(args);
				sus3.assessAssignment();
			}
		}
		finally
		{
			if(sus1 != null)
			{
				sus1.close();
			}
			
			if(sus2 != null)
			{
				sus2.close();
			}
			
			if(sus3 != null)
			{
				sus3.close();
			}
		}
	}
}